﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using OrganizedIN.BAL;
using OrganizedIN.BussinessServices;
namespace OrganizedIN.UI.Document
{
    public partial class Add_New_Document : System.Web.UI.Page
    {
        DateTime dt = DateTime.Now;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                save_button.Attributes.Add("onClick", "return CheckValidation()");
                lblTodayDate.Text = String.Format("{0:D}", dt);
                //lblusername.Text = Convert.ToString(Session["FName"]);
            }
            catch (Exception EX)
            {
            }
        }

        protected void save_button_Click(object sender, EventArgs e)
        {
            try
            {
                BLL AddNewDoc = new BLL();
                MyProfileDocument setdata = new MyProfileDocument();
                setdata.DocumentID = Convert.ToString(Session["UserID"]);
                setdata.DocumentCreateDate = String.Format("{0:d/M/yyyy HH:mm:ss}", dt);
                setdata.DocumentSummary = txtSummary.Text;
                setdata.DocumentRating = ddlrating.SelectedItem.Text;
                setdata.DocumentSharerName = txtshare.Text;
                setdata.DocumentAttachment = txtFileUpload.FileName.Trim();
                setdata.DocumentPriority = ddlpriority.SelectedItem.Text;
                AddNewDoc.ProfileDocumentInsert(setdata);
                Clear();
            }
            catch (Exception ex)
            {
            }
        }
        protected void Clear()
        {
            txtSummary.Text = "";
            txtshare.Text = "";
        }
    }
}
